from random import randint

for i in range(2,10+1,2): #0-10,第一个参数代表下线，第二个代表上线，第三个参数代表步长(每次间隔几个数字)
    print(i,end="\n")
#打印100以内能被三整除的数字
for i1  in range(1,100):
    if i1%3==0:
        print(i1,end="\t")
#猜数字
#产生随机数
num=randint(1,30)
print(num)
while True:
    guess=int(input("请输入一个数字:"))
    if(guess>num):
        print("太大了")
    elif(guess<num):
        print("太小了")
    else:
        print("猜对了")
        break #结束循环
#逢七过小游戏
for i in range(1,100+1):
    if i%7==0 or str(i).find('7') != -1:
        print(i,end=" ")
#打印菱形(调用center函数)
for i in range(1,11,2):
    print(("*"*i).center(11))
for i in range(11,1,-2):
    print(("*"*i).center(11))
#打印菱形(利用双层循环)
for i in range(1,11,1):
    print(" "*(11-i)+"*"*(i+i-1))
for j in range(11,0,-1):
    print(" "*(11-j)+"*"*(j+j-1))
#打印水仙花数
for i in range(100,1000):
    ge=i%10
    shi=i//10%10
    bai=i//100
    if ge**3+shi**3+bai**3==i:
        print(i)
#打印九九乘法表
for i in range(1,10):
    for j in range (1,i+1):
        print("%d*%d=%d"%(j,i,j*i),end=" ")
    print()
#打印斐波那契数列
def fib(n):
    if n==1 or n==2:
        return 1
    return fib(n-1)+fib(n-2)
for i in range(1,10):
    print(fib(i))

#打印100以内的质数
def isprime(n):
    for i in range(2,n):
        if n%i==0:
            return False
    return True
for i in range(1,101):
    if isprime(i):
        print(i,end=" ")
print()
#打印100以内的完数
for i in range(1,101):
    sum=0
    for j in range(1,i):
        if i%j==0:
            sum+=j
    if sum==i:
     print(i,end="\t")